import request from '@/config/axios'

// 风险评估记录 VO
export interface RiskAssessmentRecordVO {
  id: number // 主键id
  applyRecordId: number // 风险申请记录id
  identifyId: number // 风险辨识id
  identifyInstanceId: number // 风险辨识实例id
  riskTargetId: number // 风险对象id
  riskTarget: string // 风险对象
  riskTargetContentId: number // 风险对象内容id
  riskTargetContent: string // 风险对象内容
  riskDegree: string // 风险程度
  riskLevel: number // 风险等级
  fixedRiskLevel: number // 风险等级
  realRiskLevel: number // 真实风险等级
  riskTargetContentUnitId: number // 风险对象内容所属单元id
  riskTargetContentUnitName: string // 风险对象内容所属单元名称
  riskTargetContentLeaderId: number // 风险对象内容负责人id
  checkCycle: number // 检查周期
  checkCycleUnit: string // 检查周期单位
  checkContents: string // 检查内容
}

// 风险评估记录 API
export const RiskAssessmentRecordApi = {
  // 查询风险评估记录分页
  getRiskAssessmentRecordPage: async (params: any) => {
    return await request.get({ url: `/zjyj/risk-assessment-record/page`, params })
  },

  // 查询风险评估记录详情
  getRiskAssessmentRecord: async (id: number) => {
    return await request.get({ url: `/zjyj/risk-assessment-record/get?id=` + id })
  },

  // 新增风险评估记录
  createRiskAssessmentRecord: async (data: RiskAssessmentRecordVO) => {
    return await request.post({ url: `/zjyj/risk-assessment-record/create`, data })
  },

  // 修改风险评估记录
  updateRiskAssessmentRecord: async (data: RiskAssessmentRecordVO) => {
    return await request.put({ url: `/zjyj/risk-assessment-record/update`, data })
  },

  // 删除风险评估记录
  deleteRiskAssessmentRecord: async (id: number) => {
    return await request.delete({ url: `/zjyj/risk-assessment-record/delete?id=` + id })
  },

  // 导出风险评估记录 Excel
  exportRiskAssessmentRecord: async (params) => {
    return await request.download({ url: `/zjyj/risk-assessment-record/export-excel`, params })
  },
  submitAssessment : async (data: any) => {
    return await request.post({ url: `/zjyj/risk-assessment-record/submitAssessment`, data })
  }
}